package facadePattern;

/**
 * 外观类
 */
public class SmartAppliancesFacade {

    public enum FURNITURE{TV_ON, TV_OFF, LIGHT_ON, LIGHT_OFF, AIRCONDITION_ON, AIRCONDITION_OFF}

    private Light light;
    private TV tv;
    private AirCondition airCondition;

    public SmartAppliancesFacade() {
        this.light = new Light();
        this.tv = new TV();
        this.airCondition = new AirCondition();
    }

    public void say(FURNITURE msg){
        switch (msg){
            case TV_ON:
                tv.on();
                break;
            case LIGHT_ON:
                light.on();
                break;
            case AIRCONDITION_ON:
                airCondition.on();
                break;
            case TV_OFF:
                tv.off();
                break;
            case LIGHT_OFF:
                light.off();
                break;
            case AIRCONDITION_OFF:
                airCondition.off();
                break;
            default:
                tv.off();
                light.off();
                airCondition.off();
        }
    }
}
